<template>
    <div id="NewsDetail">
        <h2>{{msg}}</h2>
        <h2>{{list.title}}</h2>
        <div v-html="list.content"></div>
      
    </div>
</template>

<script>

export default {
    data(){
        return{
            msg:'我是一个NewsDetail组件',
            list:[]
        }
    }, 
    methods:{
        requestNewsDetail(aid){
            var api='http://www.phonegap100.com/appapi.php?a=getPortalArticle&aid='+aid;
            // get请求如果跨域的话,后台php/java要允许跨域请求
            this.$http.get(api).then(response=>{
                console.log(response);
                this.list=response.body.result[0];
            },error=>{
                console.log(error);
            })
        }
    },
    components:{

    }, 
    mounted(){
        //console.log(this.$route.params); /*获取动态路由传值*/
        var aid=this.$route.params.aid;
        this.requestNewsDetail(aid);
    }
}
</script>

